/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-12-11 14:46:55
 * @LastEditors: GGB
 * @LastEditTime: 2021-12-11 17:50:17
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import path from "path";
import { viteMockServe } from "vite-plugin-mock";
// 导入插件
import vueI18n from "@intlify/vite-plugin-vue-i18n";
// const resolvePath = dir => path.join(__dirname, dir);

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "/@": path.resolve(__dirname, "src"),
      comps: path.resolve(__dirname, "src/components"),
      styles: path.resolve(__dirname, "src/styles"),
      plugins: path.resolve(__dirname, "src/plugins"),
      views: path.resolve(__dirname, "src/views"),
      layouts: path.resolve(__dirname, "src/layouts"),
      utils: path.resolve(__dirname, "src/utils"),
      apis: path.resolve(__dirname, "src/apis"),
      dirs: path.resolve(__dirname, "src/directives"),
      // "@": resolvePath("src"),
      // "comps": resolvePath("src/components"),
      // "apis": resolvePath("src/apis"),
      // "views": resolvePath("src/views"),
      // "utils": resolvePath("src/utils"),
      // "routes": resolvePath("src/routes"),
      // "styles": resolvePath("src/styles")
    },
  },
  plugins: [
    vue(),
    vueJsx(),
    viteMockServe(),
    vueI18n({
      // if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
      // compositionOnly: false,
      // you need to set i18n resource including paths !
      include: path.resolve(__dirname, "./src/locales/**"),
    }),
  ],
});
